import { BrowserModule } from "@angular/platform-browser";
import { NgModule } from "@angular/core";

import { AppComponent } from "./app.component";
import { Iwe7FormBuilderModule } from "./iwe7-form-builder/iwe7-form-builder.module";
import { Iwe7ToolsModule } from "./iwe7-tools/iwe7-tools.module";
import { RouterModule, UrlSerializer } from "@angular/router";
import { Iwe7FormPreviewModule } from "./iwe7-form-preview/iwe7-form-preview.module";
import { MeepoUrlSerializer } from "we7-router";

export function loadRouterChildren(){
  return Iwe7FormBuilderModule;
}
@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,
    Iwe7FormBuilderModule.forRoot(),
    Iwe7ToolsModule.forRoot({
      root: "https://meepo.com.cn/",
      i: "2",
      m: "runner_open"
    }),
    RouterModule.forRoot([
      {
        path: "web/site/entry/iiwe7_demo",
        loadChildren: loadRouterChildren
      },
      {
        path: "app/entry/site/iiwe7_demo",
        loadChildren: loadRouterChildren
      }
    ]),
    Iwe7FormPreviewModule
  ],
  providers: [
    {
      provide: UrlSerializer,
      useClass: MeepoUrlSerializer
    }
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}
